C_FLAGS=-Wall -Wextra
C_DEBUG_FLAGS= $(C_FLAGS) -g
C_RELEASE_FLAGS= $(C_FLAGS) -O3
L_FLAGS=

SOURCES = main.c lista.c typwartosc.c
RELEASE_OBJECTS = $(SOURCES:.c=.o)
DEBUG_OBJECTS = $(addprefix dbg_,$(SOURCES:.c=.o))

all: release debug

release: $(RELEASE_OBJECTS)
	gcc $^ -o $@ $(LFLAGS)

$(RELEASE_OBJECTS): %.o: %.c
	gcc -c $< -o $@ $(C_RELEASE_FLAGS)
	
debug: $(DEBUG_OBJECTS)
	gcc $^ -o $@ $(LFLAGS)

$(DEBUG_OBJECTS): dbg_%.o: %.c
	gcc -c $< -o $@ $(C_DEBUG_FLAGS)
	
clean:
	rm -f *.o *.exe

.PHONY: clean	